package datebase.live.access;

import models.AchivementModel;

import com.trackvoodoo.models.AchivementsDocument.Achivements;
import com.trackvoodoo.models.DbPopulateDocument.DbPopulate;

import database.live.DOAStatements;
import database.live.MySqlDAO;

public class AchivementsDAO {
	
	private AchivementsDAO(){}
	
	public int addAchivement(String internalName, String description, boolean instant, int count, int points, String notJpg, String gotJpg) //internalName, description, instant, count, points, notJpg, gotJpg
	{
		DbPopulate db = DbPopulate.Factory.newInstance();
		MySqlDAO.addDBElement(db, 1, internalName);
		MySqlDAO.addDBElement(db, 2, description);
		MySqlDAO.addDBElement(db, 3, instant);
		MySqlDAO.addDBElement(db, 4, count);
		MySqlDAO.addDBElement(db, 5, points);
		MySqlDAO.addDBElement(db, 6, notJpg);
		MySqlDAO.addDBElement(db, 7, gotJpg);
		
		
		return MySqlDAO.parseAndUpdateInsertDelete(DOAStatements.ADD_ACHIVEMENT,db);
	}
	
	public int deleteAchivement(int id)
	{
		DbPopulate db = DbPopulate.Factory.newInstance();
		MySqlDAO.addDBElement(db, 1, id);	
		return MySqlDAO.parseAndUpdateInsertDelete(DOAStatements.DELETE_ACHIVEMENT,db);
	}
	
	public Achivements getAchivements()
	{
		return new AchivementModel().getAchivementModel();
	}
}

